package com.xd.sys.listener;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import com.xd.stat.utils.ZXingCodeEncodeUtils;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.io.InputStream;

@WebListener
public class AppListener implements ServletContextListener{

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		//取到ServletContext
		ServletContext context=arg0.getServletContext();
		context.setAttribute("xd", context.getContextPath());

		//二维码测试
		//获取InputStream
//		InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("face_heima.jpg");
//		String content="肖迪";
//
//		//生成二维码
//		ZXingCodeEncodeUtils.createZxingCodeUseLogoSaveToDisk(content,300,300
//				,"D:/temp/xd.gif","JPEG",resourceAsStream);
//		System.out.println("二维码生成成功");

	}

}
